import java.io.*;

/*
ID: huangmingbo
LANG: JAVA
TASK: namenum
*/
public class namenum {


    public static void main(String[] args) throws IOException {
        try (
                BufferedReader txtReader = new BufferedReader(new InputStreamReader(namenum.class.getResourceAsStream("dict.txt")));
                BufferedReader inReader = new BufferedReader(new InputStreamReader(namenum.class.getResourceAsStream(namenum.class.getSimpleName() + ".in")));
                PrintWriter writer = new PrintWriter(new FileWriter(namenum.class.getSimpleName() + ".out"));
        ) {
            byte[] charMap = new byte[26];
            initCharMap(charMap);

            String tmpS;
            LinkArr list = new LinkArr(4000, charMap);
            while ((tmpS = txtReader.readLine()) != null) {
                list.put(tmpS);
            }

            long number = Long.parseLong(inReader.readLine());
            LinkArr.node ret = list.get(number);
            if (ret == null) {
                writer.println("NONE");
                return;
            }

            for (int i = 0; i < ret.valueLen; i++) {
                writer.println(ret.values[i]);
            }
        }
    }

    private static void initCharMap(byte[] charMap) {


        /*
          2: A,B,C     5: J,K,L    8: T,U,V
          3: D,E,F     6: M,N,O    9: W,X,Y
          4: G,H,I     7: P,R,S
         */

        charMap['A'-'A']=charMap['B'-'A']=charMap['C'-'A'] = 2;
        charMap['D'-'A']=charMap['E'-'A']=charMap['F'-'A'] = 3;
        charMap['G'-'A']=charMap['H'-'A']=charMap['I'-'A'] = 4;
        charMap['J'-'A']=charMap['K'-'A']=charMap['L'-'A'] = 5;
        charMap['M'-'A']=charMap['N'-'A']=charMap['O'-'A'] = 6;
        charMap['P'-'A']=charMap['R'-'A']=charMap['S'-'A'] = 7;
        charMap['T'-'A']=charMap['U'-'A']=charMap['V'-'A'] = 8;
        charMap['W'-'A']=charMap['X'-'A']=charMap['Y'-'A'] = 9;
    }

    private static class LinkArr {

        byte[] charMap;
        node[] nodes;

        public LinkArr(int initLen, byte[] charMap) {
            this.nodes = new node[initLen];
            this.charMap = charMap;
        }

        public void put(String value) {
            // get the number
            long number = getCharsNumber(value);

            // get the node index
            int hashIndex = getHashIndex(number);

            // find if exits
            node n = nodes[hashIndex];
            if (null == n) {
                n = new node(number, value);
                nodes[hashIndex] = n;
                return;
            }

            while (true) {
                if (number == n.number) {
                    n.addValue(value);
                    return;
                }

                if (n.next == null) {
                    break;
                }

                n = n.next;

            }
            ;

            n.next = new node(number, value);
        }

        private long getCharsNumber(String value) {
            byte tmp;
            long tl = 0;
            for (int i = 0; i < value.length(); i++) {
                tmp = this.charMap[value.charAt(i) - 'A'];
                tl += tmp * Math.pow(10, value.length() - 1 - i);
            }
            return tl;
        }

        private int getHashIndex(long number) {
            int t =  (int) (number ^ number >>> 32);
            if (t < 0) {
                t = -t;
            }

            return t % nodes.length;
        }

        public node get(long number) {
            int hashIndex = getHashIndex(number);
            node n = this.nodes[hashIndex];
            if (n == null) {
                return null;
            }

            do {
                if (n.number == number) {
                    return n;
                }

                n = n.next;

            } while (null != n);


            return null;
        }

        class node {

            node next;
            long number;
            String[] values;

            int valueLen;

            public node(long number, String value) {
                this.number = number;
                this.values = new String[100];
                this.values[valueLen++] = value;
                this.next = null;
            }

            public void addValue(String value) {
                if (valueLen >= this.values.length) {
                    String[] tmp = new String[valueLen + 100];
                    System.arraycopy(this.values, 0, tmp, 0, valueLen);
                    this.values = tmp;
                }

                this.values[valueLen++] = value;
            }
        }
    }
}
